package com.lagou.edu;

import com.lagou.edu.entity.Resume;
import com.lagou.edu.repository.ResumeRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.util.Date;
import java.util.List;

/**
 * @author 赵虎
 * @date 2021/3/12 6:27 下午
 */
@SpringBootApplication
public class MongoRepositoryMain {

    public static void main(String[] args) {
        ApplicationContext applicationContext = SpringApplication.run(MongoRepositoryMain.class,args);
        ResumeRepository resumeRepository = applicationContext.getBean(ResumeRepository.class);

        Resume resume =new Resume();
        resume.setName("张三");
        resume.setSalary(18000);
        resume.setCity("sh");
        resume.setBirthday(new Date());
        resumeRepository.insert(resume);

        List<Resume> all = resumeRepository.findAll();
        for (Resume resume1 : all) {
            System.out.println(resume1.toString());
        }

    }
}
